
package edu.uts.reekie.designer.implementation.edit;

import java.util.List;

import org.eclipse.swt.accessibility.AccessibleEvent;

import org.eclipse.gef.AccessibleEditPart;
import org.eclipse.gef.EditPolicy;

import edu.uts.reekie.designer.implementation.model.ViewDiagram;
import edu.uts.reekie.designer.edit.ViewNodeEditPart;
import edu.uts.reekie.designer.edit.LogicContainerEditPolicy;
import edu.uts.reekie.designer.figures.FigureFactory;
import edu.uts.reekie.designer.model.ModelFactory;


abstract public class ViewContainerEditPart
	extends ViewNodeEditPart
{
	
public ViewContainerEditPart(ModelFactory mf, FigureFactory ff) {
		super(mf, ff);
	}

protected AccessibleEditPart createAccessible() {
	return new AccessibleGraphicalEditPart(){
		public void getName(AccessibleEvent e) {
			e.result = getConceptualViewDiagram().toString();
		}
	};
}

/**
 * Installs the desired EditPolicies for this.
 */
protected void createEditPolicies() {
	super.createEditPolicies();
	installEditPolicy(EditPolicy.CONTAINER_ROLE, new LogicContainerEditPolicy());
}

/**
 * Returns the model of this as a ViewDiagram.
 *
 * @return  ViewDiagram of this.
 */
protected ViewDiagram getConceptualViewDiagram() {
	return (ViewDiagram)getModel();
}

/**
 * Returns the children of this through the model.
 *
 * @return  Children of this as a List.
 */
protected List getModelChildren() {
	return getConceptualViewDiagram().getChildren();
}

}
